﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace B121 {
    public partial class AddNewProfileForm : Form {
        public AddNewProfileForm() {
            InitializeComponent();
        }

        // Do this some other way, so the new profile does not close
        // (Something with the accept button I think)
        private void addNewProfileBtn_Click(object sender, EventArgs e) {
            if (profileNameTxtBox.Text == null || profileNameTxtBox.Text == "") {
                MessageBox.Show("Specified name is not valid");
                //throw new ArgumentException("The name of the profile is invalid!"); // lidt voldsomt med en exception? 0o
           
                //Check if the profile alreadu 
            } else {
                Directory.CreateDirectory(Application.StartupPath + "/Profiles/" + profileNameTxtBox.Text);
                this.Close();
            }
        }

        private void invisibleCancelButton_Click(object sender, EventArgs e) {
            this.Close();
        }

        private void profileNameTxtBox_TextChanged(object sender, EventArgs e) {
            addNewProfileBtn.Enabled = (profileNameTxtBox.Text != "" ? true : false);
        }
    }
}
